On Win32, make graphical tablets work on multi-monitor systems. (#145467,
authorRobert Ögren <gtk@roboros.com>
Thu, 26 Aug 2004 00:57:40 +0000 (00:57 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 26 Aug 2004 00:57:40 +0000 (00:57 +0000)
2004-08-22  Robert Ögren  <gtk@roboros.com>

On Win32, make graphical tablets work on multi-monitor systems.
(#145467, reported by buttknock1@ya...)

* gdk/win32/gdkinput-win32.c (gdk_input_translate_coordinates):
Use dimensions of _gdk_parent_root as screen size.
(gdk_input_get_root_relative_geometry): Get coordinates relative
to GDK root window instead of Win32 coordinates.
(_gdk_input_other_event): Updated accordingly.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/win32/gdkinput-win32.c

index 5d6aaa50b29d42eb326af78db510290db0c7184b..37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-08-22  Robert Ögren  <gtk@roboros.com>
+
+       On Win32, make graphical tablets work on multi-monitor systems.
+       (#145467, reported by buttknock1@ya...)
+
+       * gdk/win32/gdkinput-win32.c (gdk_input_translate_coordinates):
+       Use dimensions of _gdk_parent_root as screen size.
+       (gdk_input_get_root_relative_geometry): Get coordinates relative
+       to GDK root window instead of Win32 coordinates.
+       (_gdk_input_other_event): Updated accordingly.
+
 Wed Aug 25 17:24:17 2004  Manish Singh  <yosh@gimp.org>
 
        * gdk/x11/gdkfont-x11.c: remove unused gdk_font_charset_for_locale()
index 5d6aaa50b29d42eb326af78db510290db0c7184b..37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf 100644 (file)
@@ -1,3 +1,14 @@
+2004-08-22  Robert Ögren  <gtk@roboros.com>
+
+       On Win32, make graphical tablets work on multi-monitor systems.
+       (#145467, reported by buttknock1@ya...)
+
+       * gdk/win32/gdkinput-win32.c (gdk_input_translate_coordinates):
+       Use dimensions of _gdk_parent_root as screen size.
+       (gdk_input_get_root_relative_geometry): Get coordinates relative
+       to GDK root window instead of Win32 coordinates.
+       (_gdk_input_other_event): Updated accordingly.
+
 Wed Aug 25 17:24:17 2004  Manish Singh  <yosh@gimp.org>
 
        * gdk/x11/gdkfont-x11.c: remove unused gdk_font_charset_for_locale()
index 5d6aaa50b29d42eb326af78db510290db0c7184b..37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf 100644 (file)
@@ -1,3 +1,14 @@
+2004-08-22  Robert Ögren  <gtk@roboros.com>
+
+       On Win32, make graphical tablets work on multi-monitor systems.
+       (#145467, reported by buttknock1@ya...)
+
+       * gdk/win32/gdkinput-win32.c (gdk_input_translate_coordinates):
+       Use dimensions of _gdk_parent_root as screen size.
+       (gdk_input_get_root_relative_geometry): Get coordinates relative
+       to GDK root window instead of Win32 coordinates.
+       (_gdk_input_other_event): Updated accordingly.
+
 Wed Aug 25 17:24:17 2004  Manish Singh  <yosh@gimp.org>
 
        * gdk/x11/gdkfont-x11.c: remove unused gdk_font_charset_for_locale()
index 5d6aaa50b29d42eb326af78db510290db0c7184b..37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf 100644 (file)
@@ -1,3 +1,14 @@
+2004-08-22  Robert Ögren  <gtk@roboros.com>
+
+       On Win32, make graphical tablets work on multi-monitor systems.
+       (#145467, reported by buttknock1@ya...)
+
+       * gdk/win32/gdkinput-win32.c (gdk_input_translate_coordinates):
+       Use dimensions of _gdk_parent_root as screen size.
+       (gdk_input_get_root_relative_geometry): Get coordinates relative
+       to GDK root window instead of Win32 coordinates.
+       (_gdk_input_other_event): Updated accordingly.
+
 Wed Aug 25 17:24:17 2004  Manish Singh  <yosh@gimp.org>
 
        * gdk/x11/gdkfont-x11.c: remove unused gdk_font_charset_for_locale()
index cd20fc3625b2a341d15e12378462a9a74608aaa7..c5534d8df1771863d9a4f58872c1aa5b0bd955a4 100644 (file)
@@ -557,7 +557,7 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
                                 gdouble          *x_out,
                                 gdouble          *y_out)
 {
-  GdkWindowImplWin32 *impl;
+  GdkWindowImplWin32 *impl, *root_impl;
 
   int i;
   int x_axis = 0;
@@ -590,8 +590,9 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
 
   if (gdkdev->info.mode == GDK_MODE_SCREEN) 
     {
-      x_scale = GetSystemMetrics (SM_CXSCREEN) / device_width;
-      y_scale = GetSystemMetrics (SM_CYSCREEN) / device_height;
+      root_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_parent_root)->impl);
+      x_scale = root_impl->width / device_width;
+      y_scale = root_impl->height / device_height;
 
       x_offset = - input_window->root_x;
       y_offset = - input_window->root_y;
@@ -658,9 +659,9 @@ gdk_input_get_root_relative_geometry (HWND w,
   GetWindowRect (w, &rect);
 
   if (x_ret)
-    *x_ret = rect.left;
+    *x_ret = rect.left + _gdk_offset_x;
   if (y_ret)
-    *y_ret = rect.top;
+    *y_ret = rect.top + _gdk_offset_y;
 }
 
 void
@@ -927,11 +928,9 @@ _gdk_input_other_event (GdkEvent  *event,
                                           &event->button.y);
 
          /* Also calculate root coordinates. Note that input_window->root_x
-            is in Win32 screen coordinates. */
-         event->button.x_root = event->button.x + input_window->root_x
-                                + _gdk_offset_x;
-         event->button.y_root = event->button.y + input_window->root_y
-                                + _gdk_offset_y;
+            is in GDK root coordinates. */
+         event->button.x_root = event->button.x + input_window->root_x;
+         event->button.y_root = event->button.y + input_window->root_y;
 
          event->button.state = ((gdkdev->button_state << 8)
                                 & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
@@ -960,11 +959,9 @@ _gdk_input_other_event (GdkEvent  *event,
                                           &event->motion.y);
 
          /* Also calculate root coordinates. Note that input_window->root_x
-            is in Win32 screen coordinates. */
-         event->motion.x_root = event->motion.x + input_window->root_x
-                                + _gdk_offset_x;
-         event->motion.y_root = event->motion.y + input_window->root_y
-                                + _gdk_offset_y;
+            is in GDK root coordinates. */
+         event->motion.x_root = event->motion.x + input_window->root_x;
+         event->motion.y_root = event->motion.y + input_window->root_y;
 
          event->motion.state = ((gdkdev->button_state << 8)
                                 & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK